<template>
  <el-container style="height: 100vh">
    <!-- 导航栏 -->
    <el-header>
      <el-menu mode="horizontal" :default-active="$route.name">
        <el-menu-item index="Home" @click="goToHome">首页</el-menu-item>
        <el-menu-item index="Restaurant" @click="goToRestaurant">餐厅</el-menu-item>
        <el-menu-item index="UserInfo" @click="goToUserInfo">用户信息</el-menu-item>
      </el-menu>
    </el-header>
    <!-- 页面内容 -->
    <el-main>
      <router-view></router-view>
    </el-main>
  </el-container>
</template>

<script>
import { useRouter } from 'vue-router'

export default {
  methods: {
    goToHome() {
      this.$router.push('/')
    },
    goToRestaurant() {
      this.$router.push('/restaurant/1')  // 这里默认跳转到餐厅页面，实际情况根据业务调整
    },
    goToUserInfo() {
      this.$router.push('/user-info')
    }
  }
}
</script>
